package com.um.weixin.mini.service.impl;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import com.um.weixin.mini.service.WxMiniMsgService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Title
 * @Description
 * @Author renjunwei
 * @Date 2023/5/31 17:33
 */
@Service
@Slf4j
public class WxMiniMsgServiceImpl implements WxMiniMsgService {

    @Autowired
    WxMaService wxMaService;

    /**
     * <pre>
     * 发送订阅消息
     * https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html
     * </pre>
     *
     * @param subscribeMessage 订阅消息
     * @throws WxErrorException .
     */
    @Override
    public void sendSubscribeMsg(WxMaSubscribeMessage subscribeMessage) throws WxErrorException {
        wxMaService.getMsgService().sendSubscribeMsg(subscribeMessage);
    }
}
